<html>
<head>
    <title>无刷新上传文件</title>
    <meta Content-type="text/html" charset="utf-8" /> 
    <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>

    <script type="text/javascript">
	
	
        function setImagePreview() {
alert(1);
            return true;
        }	
	
	
	
	
        function startUpload() {
             document.getElementById('processing').innerHTML = 'loding...';
			 console.log();
			 $('.___upfile').submit();
            return true;
        }
         
        function stopUpload(rel){
            var msg;
            switch (rel) {
                case 0:
                    msg = "上传成功";
                    break;
                case 1:
                    msg = "上传的文件超过限制";
                    break;
                case 2:
                    msg = "只能上传图片文件";
                    break;
                default:
                    msg = "上传文件失败";
            }    
            document.getElementById('processing').innerHTML = msg;
        }
    </script>
</head>
<body>
    <div style="text-align:center">
        <div id="processing"></div>
        <form class="___upfile" action="/__/upload.php" method="post" enctype="multipart/form-data" target="form-target">
            <input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
            <input type="file" name="myfile"  onchange="javascript:setImagePreview();"/>
            <input type="submit" name="sub" value="upload" />
        </form>
        <iframe style="width:0; height:0; border:0;" name="form-target"></iframe>
    </div>
</body>
</html>